package com.lizemin.builderfactorycase.base;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.Base64;
import java.util.Random;

/**
 * @author lzm
 * @date 2025/10/11 21:38
 * @description
 */
public class Cat {

    private String name;

    private Integer age;

    public String getName() {
        byte[] bytes = new byte[16];
        new Random().nextBytes(bytes);
        return Base64.getEncoder().encodeToString(bytes);
    }

    public Integer getAge() {
        return new Random().nextInt(100);
    }

    public static void main(String[] args) throws JsonProcessingException {
        Cat cat = new Cat();
        for (int i = 0; i < 10; i++) {
            System.out.println(new ObjectMapper().writeValueAsString(cat));
        }
    }
}
